from app.extensions import db

class Statistics(db.Model):
    __tablename__ = 'statistics'

    id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
    type = db.Column(db.String(20), nullable=False)
    date = db.Column(db.Date, nullable=False)
    count = db.Column(db.Integer, default=0, nullable=False)
    category = db.Column(db.String(20))

    __table_args__ = (
        db.UniqueConstraint('type', 'date', 'category', name='uk_type_date_category'),
    )